package com.cindata

import com.cindata.dictionary.AttachmentType

class Attachment
{
    AttachmentType type
    String fileName
    String fileUrl
    String thumbnailUrl

    String description
    Integer displayOrder = 0

    Date createdDate = new Date()
    Date modifiedDate = new Date()
    User createBy
    User modifyBy

    static belongsTo = [mortgage: Mortgage, estate: Estate, contract: Contract, warrant: Warrant, collateral: Collateral, riskWarning: RiskWarning, contactWarningDisposal :ContactRiskWarningDisposition, abnormalMortgageBatch: AbnormalMortgageBatch, account: Account]

    static mapping = {
        autowire true
    }

    static constraints = {
        
        fileName maxSize: 100
        fileUrl maxSize: 512, nullable: true, blank: true
        thumbnailUrl maxSize: 512, nullable: true, blank: true
        description nullable: true, blank: true, maxSize: 200

        mortgage nullable: true, blank: true
        estate nullable: true, blank: true
        contract nullable: true, blank: true
        warrant nullable: true, blank: true
        collateral nullable: true, blank: true
        riskWarning nullable: true, blank: true
        contactWarningDisposal nullable: true, blank: true
        abnormalMortgageBatch nullable: true, blank: true
        account nullable: true, blank: true

        createBy nullable: true, blank: true
        modifyBy nullable: true, blank: true
    }
}
